<%@ Control Language="c#" AutoEventWireup="false" Codebehind="FileList.ascx.cs" Inherits="CommunityServer.ControlPanel.Files.FileList1" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<%@ Register TagPrefix="CA" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %>
<%@ Register TagPrefix="CS" Namespace="CommunityServer.Controls" Assembly="CommunityServer.Controls" %>
<%@ Register TagPrefix="CP" Namespace="CommunityServer.ControlPanel.Controls" Assembly="CommunityServer.Web" %>
<script language = "javascript" type="text/javascript">
function SelectColumn(column)
{
    alert(column.GetMember('PostID').Text);
}

function onCallbackError(excString)
{
	if (confirm('<%= CommunityServer.ControlPanel.Components.ResourceManager.GetString("CP_CallBackWarning") %>')) alert(excString); 
	<%=	Grid1.ClientID %>.Page(1); 
}

function onDelete(item)
{
	return confirm('<%= CommunityServer.ControlPanel.Components.ResourceManager.GetString("CP_Files_FileList_Delete") %>'); 
}
function deleteRow(rowId)
{
	<%= Grid1.ClientID %>.Delete(<%= Grid1.ClientID %>.GetRowFromClientId(rowId)); 
}

</script>
<script language="javascript">
	function validate_click()
	{
		var element = $('<%=  ActionList.ClientID %>');
		
		if(element.options[0].selected)
		    return false;
		
		if(element.options[3].selected)
		{
			return confirm('<%= CommunityServer.ControlPanel.Components.ResourceManager.GetString("CP_Files_FileList_DeleteSelected") %>');
		}
		return true;
	}
</script>
	<table cellpadding="0" cellspacing="0" border="0"  width="100%">
		<tr>
			<td width="100%">
				<CP:ResourceControl resourcename="CP_Files_FileList_FilterBy" runat="Server" id="FeedbackFilterLabel"/>
				<asp:DropDownList id="CategoryList" Runat="Server" />
				<asp:DropDownList id="PublishedStatusList" Runat="Server" />
				<asp:Button Runat="server" Text="Apply Filter" id="Button1" />
			</td>
			<td nowrap="true">
				<asp:LinkButton Runat="server" ID="NewPost" CssClass="CommonTextButton"><CP:ResourceControl runat="server" resourcename="CP_Files_FileList_New" ID="Resourcecontrol1" NAME="Resourcecontrol1"/></asp:LinkButton>
				<asp:LinkButton Runat="server" CssClass="CommonTextButton" ID="Categories"><CP:ResourceControl runat="server" resourcename="CP_Files_FileList_ManageCategories" ID="Resourcecontrol2" NAME="Resourcecontrol2"/></asp:LinkButton>
			</td>
		</tr>
	</table>
<br />

<div id="GrayGrid">
<CA:grid runat="Server" 
	id="Grid1" 
	CssClass="Grid" 
	RunningMode="Client" 
	AutoCallBackOnDelete="true" 
	ClientSideOnDelete="onDelete" 
	ClientSideOnCallbackError="onCallbackError" >
    <Levels>
        <CA:gridlevel datakeyfield="PostID" >
            <Columns>
				<CA:GridColumn ColumnType="CheckBox" Align="Center" AllowEditing="True" />
                <CA:GridColumn DataField="Subject" HeadingText="ResourceManager.CP_Files_FileGrid_Title" />
                <CA:GridColumn DataField="Views" HeadingText="ResourceManager.CP_Files_FileGrid_Views" Align = "Center" />
                <CA:GridColumn DataField="Downloads" HeadingText="ResourceManager.CP_Files_FileGrid_Downloads" Align = "Center" />
                <CA:GridColumn DataField="Replies" HeadingText="ResourceManager.CP_Files_FileGrid_Comments" Align = "Center" />
                <CA:GridColumn DataField="PostDate" HeadingText="ResourceManager.CP_Files_FileGrid_PublishedDate" FormatString="MMM dd yyyy, hh:mm tt" />
                <CA:GridColumn DataField="IsApproved" HeadingText="ResourceManager.CP_Files_FileGrid_Published" Align = "Center" />
                <CA:GridColumn DataField="Username" Visible = "false" />
				<CA:GridColumn DataField="DisplayName" Visible="false" />
                <CA:GridColumn DataField="SectionID" Visible = "false" />
                <CA:GridColumn DataField="PostID" Visible = "false" />
                <CA:GridColumn DataField="BlogPostType" Visible = "false" />
                <CA:GridColumn DataField="PostID" Visible = "false" />
                <CA:GridColumn datafield="ViewPostURL" visible = "false" />
                <CA:GridColumn datafield="AuthorURL" visible = "false" />
                <CA:gridcolumn headingtext="ResourceManager.CP_Files_FileGrid_Actions" datacellclienttemplateid = "ActionTemplate" />
            </Columns>
        </CA:gridlevel>
    </Levels>
    <ClientTemplates>
        <CA:ClientTemplate Id="ActionTemplate">
            <a href="fileeditor.aspx?sectionid=## DataItem.GetMember('SectionID').Text ##&PostID=## DataItem.GetMember('PostID').Text ##" class="CommonTextButton">Edit</a>
            <a href="javascript:deleteRow('## DataItem.ClientId ##')" class="CommonTextButton">Delete</a>
            <a href="## DataItem.GetMember('ViewPostURL').Text ##" class="CommonTextButton">View</a>
            <a href="userdownloads.aspx?pid=## DataItem.GetMember('PostID').Text ##" class="CommonTextButton">Download(s) Report</a>
        </CA:ClientTemplate>
    </ClientTemplates>
</CA:grid>
</div>
<p id="Actions"  class="PanelSaveButton">
			<cp:helpicon id="Helpicon1" runat="Server" resourcename="CP_Moderate_Help"></cp:helpicon>&nbsp;
			<asp:dropdownlist id="ActionList" runat="server"></asp:dropdownlist>&nbsp;
			<asp:button id="ActionButton" runat="Server" Text="Go"></asp:button>
</p>
